let id = location.search.slice(4);
console.log(id);
let xhr1 = new XMLHttpRequest();
xhr1.open('get', `http://39.105.198.203:3001/prod/det?tid=${id}`);
xhr1.send();
xhr1.onreadystatechange = function () {
    if (this.readyState === 4) {
        let res = JSON.parse(this.responseText);
        console.log(res)
        if (this.readyState === 4) {
            function lunbo() {
                let box = $('<div></div>')
                box.html(`
                                    
                        <div id="carouselExampleIndicators" class="carousel slide shou" data-ride="carousel">
                        <ol class="carousel-indicators">
                            <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
                            <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                            <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
                        </ol>
                        <div class="carousel-inner">
                            <div class="carousel-item active">
                            <img class="pic1" src="${res.data.imgarr[0]}" class="d-block w-100" alt="...">
                            </div>
                            <div class="carousel-item">
                            <img class="pic1" src="${res.data.imgarr[1]}" class="d-block w-100" alt="...">
                            </div>
                            <div class="carousel-item">
                            <img class="pic1" src="${res.data.imgarr[2]}" class="d-block w-100" alt="...">
                            </div>
                        </div>
                        <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
                            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                            <span class="sr-only">Previous</span>
                        </a>
                        <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
                            <span class="carousel-control-next-icon" aria-hidden="true"></span>
                            <span class="sr-only">Next</span>
                        </a>
                        </div>
                        <div class="content">
                        <div>
                            <img class="contentPic" src="${res.data.fullSrc}" alt="">
                        </div>
                        <div class="contentBox">
                            <div class="content1">
                            <p>${res.data.tname}</p>
                            <p>${res.data.tintro}</p>
                            </div>
                            <p class="content2">
                            <span class="text">￥</span>
                            <span class="text1">${res.data.price}</span>
                            <span class="text">.00</span>
                            </p>
                        </div>
                        </div>
                        <div>
                        <img class="bigPic" src="${res.data.banner}" alt="">
                        </div>
                
                `)
                $('.xuanran').append(box)
            }

        }
        lunbo();
        $('.carousel').carousel({
            interval: 2000
        });
    }
}

